#pragma once

#include <gl/glew.h>

#include <vector>

#include "link.h"
#include "physicsobject.h"
#include "pickable.h"

class Model;

enum Direction{ INVALID = -1, UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, FRONT = 4, BACK = 5};

class Module:public PhysicsObject, public Pickable{
    public:
        Module(int w, int h);

        void Draw();
        void Pick();

        virtual void Update(int dt);

        virtual void RotateToNewHeading(Math::Vector3 axis, float angle);

        Link* CheckLinkID(unsigned int id);


        void AttachModule(Module* newModule, Link* link);

        Link* GetBaseLink(){ return &links.at(0); }

    private:
        std::vector<Link> links;
        float rotate;

        int width;
        int height;

        bool movable;

        Model* model;
        GLuint vertexVBO;
        GLuint normalVBO;
        GLuint modelVAO;
};
